﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;

namespace hzGis.service.impl
{
   public class LicenseService
    {
        public static void init()
        {
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
            //以下为新增的代码
            IAoInitialize aoInit = new AoInitialize();
            aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
        }

        public static void removeResource(IWorkspaceFactory shpWorkspaceFactory)
        {
            IWorkspaceFactoryLockControl shpWsFactoryLock = (IWorkspaceFactoryLockControl)shpWorkspaceFactory;
            if (shpWsFactoryLock.SchemaLockingEnabled)
            {
                shpWsFactoryLock.DisableSchemaLocking();
            }
        }

        public static void removeObject(System.Object obj)
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
        }
        
    }
}
